package com.ccp.dev.form.model;

import com.ccp.dev.core.basic.model.BaseModel;
import com.ccp.dev.form.util.PlatformType;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlRootElement;

/**
 * form_rights Model对象
 *
 * @author caishaofan
 */
@XmlRootElement(name = "bpmFormRights")
@XmlAccessorType(XmlAccessType.NONE)
public class FormRights extends BaseModel implements Cloneable{

	public static final short FIELD_RIGHTS=1;
	
	public static final short TABLE_RIGHTS=2;
	
	public static final short OPINION_RIGHTS=3;
	/**子表是否显示*/
	public static final short TABLE_SHOW_RIGHTS=4;

	public static String TYPE_NONE = "none";
	/**所有人*/
	public static String TYPE_EVERYONE = "everyone";
	/**用户*/
	public static String TYPE_USER = "user";
	/**角色*/
	public static String TYPE_ROLE = "role";
	/**组织*/
	public static String TYPE_ORG = "org";
	/**组织负责人*/
	public static String TYPE_ORGMGR ="orgMgr";
	/**岗位*/
	public static String TYPE_POS ="pos";

    protected PlatformType platformType = PlatformType.PC;

	/** id*/
	@XmlAttribute
	protected String id;

	/** 表单定义KEY*/
	@XmlAttribute
	protected String formKey;

	/** 字段名*/
	@XmlAttribute
	protected String name;

	/** 权限*/
	@XmlAttribute
	protected String permission = "";

	/** 权限类型(1,字段,2,子表,3,意见)*/
	@XmlAttribute
	protected short type=1;

	/** 流程定义ID*/
	@XmlAttribute
	protected String actDefId="";

	/** 父流程定义ID（是子流程才有值的）*/
	@XmlAttribute
	protected String parentActDefId="";

	/** 流程任务ID*/
	@XmlAttribute
	protected String nodeId="";

	/** 排序*/
	@XmlAttribute
	protected Integer sn=0;

	/** 所属平台*/
	@XmlAttribute
	protected Integer platform =0;

	public FormRights(){
		super();
	}

	public FormRights(String id, String formKey, String name, String permission, short type, Integer platform){
		super();
		this.id = id;
		this.formKey = formKey;
		this.name = name;
		this.permission = permission;
		this.type=type;
		this.platform=platform;
	}
	public FormRights(String id, String formKey, String name, String permission,short type){
		super();
		this.id = id;
		this.formKey = formKey;
		this.name = name;
		this.permission = permission;
		this.type=type;
	}

	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public String getFormKey() {
		return formKey;
	}

	public void setFormKey(String formKey) {
		this.formKey = formKey;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getPermission() {
		return permission;
	}

	public void setPermission(String permission) {
		this.permission = permission;
	}

	public short getType() {
		return type;
	}

	public void setType(short type) {
		this.type = type;
	}

	public String getActDefId() {
		return actDefId;
	}

	public void setActDefId(String actDefId) {
		this.actDefId = actDefId;
	}

	public String getParentActDefId() {
		return parentActDefId;
	}

	public void setParentActDefId(String parentActDefId) {
		this.parentActDefId = parentActDefId;
	}

	public String getNodeId() {
		return nodeId;
	}

	public void setNodeId(String nodeId) {
		this.nodeId = nodeId;
	}

	public Integer getSn() {
		return sn;
	}

	public void setSn(Integer sn) {
		this.sn = sn;
	}

	public Integer getPlatform() {
		return platform;
	}

	public void setPlatform(Integer platform) {
		this.platform = platform;
	}

	@Override
	public String toString() {
		return "FormRights{" +
				"id='" + id + '\'' +
				", formKey='" + formKey + '\'' +
				", name='" + name + '\'' +
				", permission='" + permission + '\'' +
				", type=" + type +
				", actDefId='" + actDefId + '\'' +
				", parentActDefId='" + parentActDefId + '\'' +
				", nodeId='" + nodeId + '\'' +
				", sn=" + sn +
				", platform=" + platform +
				'}';
	}

	@Override
	public Object clone()
	{
		FormRights obj=null;
		try{
			obj=(FormRights)super.clone();
		}catch (CloneNotSupportedException e) {
			e.printStackTrace();
		}
		return obj;
	}
}